using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using Newtonsoft.Json;


public class BagDataProxy : PureMVC.Patterns.Proxy
{
    public new static string NAME = "BagModle";
    public List<BagModel> bagModels;
    public BagDataProxy(string name) : base(name)
    {
        bagModels = new List<BagModel>();
        ReadJsonData();
    }

    private void ReadJsonData()
    {
        string info = File.ReadAllText(Application.dataPath + "/AllData.json");
        bagModels = JsonConvert.DeserializeObject<List<BagModel>>(info);
    }
    public void AddBag(BagModel model)
    {
        bagModels.Add(model);
    }
    public void ReMoveBag(BagModel model)
    {
        if (bagModels.Contains(model))
        {
            bagModels.Remove(model);
        }
    }
    public void Clear()
    {
        bagModels.Clear();
    }
    public override void OnRegister()
    {
        base.OnRegister();
    }
    public override void OnRemove()
    {
        base.OnRemove();
    }
}
